#define _GNU_SOURCE
#include "app_pool.h"
#include "log/log.h"
#include "pthread.h"
#include "unistd.h"
#include "stdlib.h"

int task(void *arg)
{
    log_debug("thread id: %ld, arg: %s", gettid(),(char *)arg);

    free(arg);
    
    return 0;
}

int main(int argc, char *argv[])
{
    app_pool_init(5);

    //char *msg = malloc(10);

    for(int i = 0; i < 10; i++)
    {
        char *msg = malloc(10);
        //char msg[10];
        sprintf(msg, "hello_%d", i);

        app_pool_registerMqTask(task, msg);

        //sleep(1);

        //free(msg);
    }

    sleep(1);

    app_pool_destroy();

    return 0;
}